// const getters = {
//   sidebar: state => state.app.sidebar,
//   device: state => state.app.device,
//   token: state => state.user.token,
//   avatar: state => state.user.avatar,
//   name: state => state.user.name
// }
// export default getters
const getters = {
  sidebar: state => state.app.sidebar,
  device: state => state.app.device,
  token: state => state.user.token, // 在根级的getters上 开发子模块的属性给别人看 给别人用
  name: state => state.user.userInfo.username,
  staffPhoto: state => state.user.userInfo.staffPhoto,
  // menus: state => state.user.userInfo.roles ? state.user.userInfo.roles.menus : [],
  // points: state => state.user.userInfo.roles ? state.user.userInfo.roles.points : []
  // es6可选链语法
  menus: state => state.user.userInfo.roles?.menus || [],
  // menus: state => state.user.userInfo.roles?.menus || [],
  points: state => state.user.userInfo.roles?.points || []
  // 这里有个小bug，当登录后去到员工管理页面退出再登录会报points获取不到值，在点击退出的时候执行了几个动作：清除token，清除userInfo，开始跳转到登录页，在清理完userInfo有没有跳到登录页的中间，由于userInfo ==={}，而menus和points是从userInfo中的roles获取数据的
}
export default getters

